<script setup lang="ts">
import { onLaunch, onShow, onHide } from '@dcloudio/uni-app'
import { useUserStore, useGlobalStore } from '@/store'

let useStore: any, globalStore: any
onLaunch(() => {
    // console.log("App Launch");
    useStore = useUserStore()
    globalStore = useGlobalStore()

    useStore.init()

    uni.setTabBarItem({
        index: 2,
        visible: useStore.userInfo?.type != 3
    })
    stockShowConfig()
})
onShow(() => {
    // console.log("App Show");
})
onHide(() => {
    // console.log("App Hide");
})
/** 配置库存 显示字段 */
function stockShowConfig() {
    uni.$u.$api.BaseApi.getStockConfig().then((res: any) => {
        globalStore.stockNames = res.map((m: any) => ({
            count: m.quantity,
            name: m.prompt
        }))
    })
}
</script>

<style lang="scss">
/* #ifndef APP-NVUE */
@import './uni_modules/vk-uview-ui/index.scss';
@import '@/static/style/iconfont.css';
@import '@/static/style/u-cover.scss';
/* #endif */

.debug {
    border: 1rpx solid red;
}
.u-btn {
    // primary
    &--p {
        background-color: #fc4f75;
        color: white;
        border: 2rpx solid #fc4f75;
    }

    // default

    &--d {
        background-color: white;
        color: #fc4f75;
        border: 2rpx solid #fc4f75;
    }

    //success
    &--s {
        background-color: #ffedf1;
        color: #fc4f75;
        border-color: #ffedf1;
    }

    //normal
    &--n {
        background-color: white;
        color: #333333;
        border: 1rpx solid #333333;
    }
    &--none {
        background-color: white;
        color: #333333;
    }
}
</style>
